SIGNAL

Section: Compatibility Functions (3C)
Updated: May 20, 1986
Index Return to Main Contents
 

NAME

signal - simplified software signal facilities  

SYNOPSIS

#include <signal.h>

(*signal(sig, func))()
int (*func)();
 

DESCRIPTION

Signal is a simplified interface to the more general sigvec(2) facility. See the sigvec(2) manual entry for complete details on how signals are handled.

If func is SIG_DFL, the default action for signal sig is reinstated. If func is SIG_IGN the signal is subsequently ignored and pending instances of the signal are discarded. Otherwise, when the signal occurs further occurrences of the signal are automatically blocked and func is called.

A return from the function unblocks the handled signal and continues the process at the point it was interrupted. Unlike previous signal facilities, the handler func remains installed after a signal has been delivered.

If a caught signal occurs during certain system calls, causing the call to terminate prematurely, the call is automatically restarted. In particular this can occur during a read or write(2) on a slow device (such as a terminal; but not a file) and during a wait(2).

The value of signal is the previous (or initial) value of func for the particular signal.

After a fork(2) or vfork(2) the child inherits all signals. Execve(2) resets all caught signals to the default action; ignored signals remain ignored.  

RETURN VALUE

The previous action is returned on a successful call. Otherwise, -1 is returned and errno is set to indicate the error.  

ERRORS

Signal will fail and no action will take place if one of the following occur:
[EINVAL]
Sig is not a valid signal number.
[EINVAL]
An attempt is made to ignore or supply a handler for SIGKILL or SIGSTOP.
[EINVAL]
An attempt is made to ignore SIGCONT (by default SIGCONT is ignored).
 

SEE ALSO

kill(1), ptrace(2), kill(2), sigvec(2), sigblock(2), sigsetmask(2), sigpause(2), sigstack(2), setjmp(3), tty(4)


 

Index

NAME
SYNOPSIS
DESCRIPTION
RETURN VALUE
ERRORS
SEE ALSO

This document was created by man2html, using the manual pages.
Time: 04:51:43 GMT, January 31, 2023